package com.caimiao.miao.page.master.system;

import android.os.Bundle;
import android.view.View;

import com.caimiao.miao.R;
import com.caimiao.miao.interfaces.BaseFragmentImpl;
import com.caimiao.miao.page.master.MasterActivity;
import com.caimiao.miao.page.master.system.server.ServerFragment;

public class SystemFragment extends BaseFragmentImpl<ISystemContact.Presenter> implements ISystemContact.View, View.OnClickListener {
    public static final String TAG = SystemFragment.class.getSimpleName();

    @Override
    public int getLayoutRes() {
        return R.layout.fragment_master_system;
    }

    @Override
    public void initUI() {
        setTitle("系统管理");
    }

    @Override
    public void initLogic() {
        mRootView.findViewById(R.id.masterSystemBtnModifyServer).setOnClickListener(this::onClick);
        mRootView.findViewById(R.id.masterSystemBtnWifi).setOnClickListener(this::onClick);
        mRootView.findViewById(R.id.masterSystemBtnGprs).setOnClickListener(this::onClick);
    }

    @Override
    public void close(Bundle extra) {

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.masterSystemBtnModifyServer:
                startClass(ServerFragment.class);
                break;
            case R.id.masterSystemBtnWifi:
                break;
            case R.id.masterSystemBtnGprs:
                break;
        }
    }

    private <T> void startClass(Class<T> tClass) {
        MasterActivity activity = (MasterActivity) getActivity();
        activity.replaceByChild(tClass);
    }
}
